package top.kaoshanji.q1ch07c;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;

/**
 * 代码清单-q1ch07c-343页a：在通道之间使用transferTo()
 * 没有执行
 * author kaoshanji
 * ^_^
 * create time 2025/3/12 18:23
 */
public class TransferTo {

    public static void main(String[] args) {

        try (FileChannel in = new FileInputStream(args[0]).getChannel();
            FileChannel out = new FileOutputStream(args[1]).getChannel()){

            in.transferTo(0, in.size(), out);

        } catch (IOException e) {
            throw new RuntimeException(e);
        }

    }


}
